<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bootstrap-轮播&附加导航</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="jquery-3.2.1.js"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <div id="myCarousel" class="carousel slide col-xs-offset-2 col-xs-8" data-interval="1000">
            <ol class="carousel-indicators">
                <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                <li data-target="#myCarousel" data-slide-to="1"></li>
                <li data-target="#myCarousel" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="item active">
                    <img src="img/1.jpeg" alt="First slide">
                    <div class="carousel-caption">标题1</div>
                </div>
                <div class="item">
                    <img src="img/1.jpeg" alt="Second slide">
                    <div class="carousel-caption">标题2</div>
                </div>
                <div class="item">
                    <img src="img/1.jpeg" alt="Third slide">
                    <div class="carousel-caption">标题3</div>
                </div>
            </div>

            <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
            <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
            <div style="text-align: center">
                <input type="button" class="btn start-slide" value="Start">
                <input type="button" class="btn pause-slide" value="Pasue">
                <input type="button" class="btn pre-slide" value="Previous">
                <input type="button" class="btn next-slide" value="Next">
                <input type="button" class="btn Slide-one" value="Slide 1">
                <input type="button" class="btn Slide-two" value="Slide 2">
                <input type="button" class="btn Slide-Three" value="Slide 3">
            </div>
        </div>
    </div>


    <div class="row">
        <div id="carousel1" class="carousel slide col-xs-offset-2 col-xs-8" data-interval="2000" style="height: 300px">
            <ol class="carousel-indicators">
                <li data-target="#carousel1" data-slide-to="0" class="active"></li>
                <li data-target="#carousel1" data-slide-to="1"></li>
                <li data-target="#carousel1" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="item active" style="background-color: red;height: 300px">
                    <div class="carousel-caption">红</div>
                </div>
                <div class="item"  style="background-color: yellow;height: 300px">
                    <div class="carousel-caption">黄</div>
                </div>
                <div class="item" style="background-color: blue;height: 300px">
                    <div class="carousel-caption">蓝</div>
                </div>
            </div>
            <a class="carousel-control left" href="#carousel1" data-slide="prev"></a>
            <a class="carousel-control right" href="#carousel1" data-slide="next"></a>
        </div>
    </div>

</div>

<script>
    $(function () {
        $(".start-slide").click(function () {
            $("#myCarousel").carousel("cycle");
        });
        $(".pause-slide").click(function () {
            $("#myCarousel").carousel("pause");
        });
        $(".pre-slide").click(function () {
            $("#myCarousel").carousel("prev");
        });
        $(".next-slide").click(function () {
            $("#myCarousel").carousel("next");
        });
        $(".Slide-one").click(function () {
            $("#myCarousel").carousel(0);
        });
        $(".Slide-two").click(function () {
            $("#myCarousel").carousel(1);
        });
        $(".Slide-three").click(function () {
            $("#myCarousel").carousel(2);
        });
        $("#myCarousel").on("slide.bs.carousel",function () {
            //alert("当调用 slide 实例方法时立即触发该事件。");
        });
        $("#myCarousel").on("slid.bs.carousel",function () {
            //alert("当调用 slid 实例方法时立即触发该事件。");
        });
    });
</script>
</body>
</html>